package com.fredy.mvp;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public abstract class BaseMvpActivity<M extends Model, V extends BaseView, P extends BasePresenter>
        extends AppCompatActivity implements BaseMvp<M, V, P> {

    protected P presenter;
 

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        presenter = createPresenter();
        if (presenter != null) {
            presenter.registerModule(createModel());
            presenter.registerView(createView());
        }
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (presenter != null) {
            presenter.destroy();
        }
    }
}
